package com.ep.modules.app.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ep.common.utils.PageUtils;
import com.ep.modules.app.dao.AppPersonalScheduleMapper;
import com.ep.modules.app.entity.AppPersonalSchedule;
import com.ep.modules.app.entity.AppPersonalScheduleExample;
import com.ep.modules.app.service.AppPersonalScheduleService;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AppPersonalScheduleServiceImpl implements AppPersonalScheduleService {
    @Autowired
    private AppPersonalScheduleMapper appPersonalScheduleMapper;

    public PageUtils queryPage(Map<String, Object> params) {
        String searchKey = (String)params.get("searchKey");
        Long searchUserId = (Long)params.get("searchUserId");
        AppPersonalScheduleExample example = new AppPersonalScheduleExample();
        AppPersonalScheduleExample.Criteria criteria = example.createCriteria();
        List<AppPersonalSchedule> list = appPersonalScheduleMapper.selectByExample(example);
        Page<AppPersonalSchedule> page = new Page<>();
        page.setRecords(list);
        return new PageUtils(page);
    }

    public AppPersonalSchedule getById(Long id) {
        return appPersonalScheduleMapper.selectByPrimaryKey(id.intValue());
    }

    public void save(AppPersonalSchedule entity) {
        appPersonalScheduleMapper.insert(entity);
    }

    public void update(AppPersonalSchedule entity) {
        appPersonalScheduleMapper.updateByPrimaryKeySelective(entity);
    }

    public void deleteBatch(Long[] ids) {
        for (Long id : ids) {
                appPersonalScheduleMapper.deleteByPrimaryKey(id.intValue());
        }
    }
}